/**
 Copyright (C) 2013 Yuyao Liang

 This source code is release under the BSD License.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.

 Created on Nov 18, 2013 3:57:40 PM
 */
package com.googlecode.backtest.rule.ta;

import java.util.HashMap;
import java.util.Map;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.googlecode.backtest.rule.ITAParameters;

/**
 * @author lianyuy
 * 
 */
@XmlRootElement(name = "TAParameters")
@XmlType(name = "TAParametersType", propOrder = { "param", "params",
		"startIndex", "stopIndex" })
public class TAParameters implements ITAParameters {

	@XmlElement
	protected int param;
	@XmlElement
	protected int startIndex;
	@XmlElement
	protected int stopIndex;
	@XmlElement
	protected Map<String, String> params = new HashMap<String, String>();

	/**
	 * 
	 */
	TAParameters() {
		super();
	}

	/**
	 * @param startIndex
	 * @param stopIndex
	 */
	public TAParameters(int param, int startIndex, int stopIndex) {
		super();
		this.param = param;
		this.startIndex = startIndex;
		this.stopIndex = stopIndex;
	}

	@Override
	public int getStartIndex() {
		return startIndex;
	}

	@Override
	public int getStopIndex() {
		return stopIndex;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.rule.IBackTestParameters#getParameter(int)
	 */
	@Override
	public int getParameter() {
		return param;
	}

	public void setParameter(String key, String value) {
		params.put(key, value);
	}

	@Override
	public String getParameter(String key) {
		return params.get(key);
	}

	public void clearParameters() {
		params.clear();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.rule.ITAParameters#setSartIndex(int)
	 */
	@Override
	public void setSartIndex(int value) {
		startIndex = value;
	}

}